package com.firefly.service.repository.cms;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.firefly.dao.dao.cms.po.LinkPo;
import com.firefly.dao.dao.cms.service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @description: 链接
 * @author: lzg(萤火科技 ： 854378082 @ qq.com)
 * @date: 2022/12/20
 **/
@Repository
public class LinkRepository {
    private final LinkService linkService;
    @Autowired
    public LinkRepository(LinkService linkService){
        this.linkService = linkService;
    }
    public Boolean create(LinkPo entity){
        return linkService.save(entity);
    }
    public Boolean update(LinkPo entity){
        return linkService.updateById(entity);
    }
    public Boolean updateDelFlagByIds(List<Integer> ids){
        UpdateWrapper<LinkPo> updateWrapper = new UpdateWrapper<>();
        updateWrapper.in("id", ids).set("del_flag", 1);
        return linkService.update(updateWrapper);
    }
}
